<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>19_案例练习-收银程序</title>
    </head>
    <body>
        <script>
            // 单价
            var price = prompt('请输入单价');

            // 数量
            var num = prompt('请输入数量');

            // 总价
            var totalPrice = price * num;

            if(totalPrice >= 500) {
                totalPrice = totalPrice * 80 / 100;
            }

            // 支付金额
            var payMoney = prompt('请支付金额' + totalPrice + '圆子');


            var changeMoney =  payMoney - totalPrice;

            if(changeMoney > 0) {
                alert('找零' + changeMoney + '元')
            }else {
                alert('你xxxx');
            }
        </script>
    </body>
</html>